<?php
class AdminModel extends Model{
	public $table='admin';//操作表
	// 会员登录
	public function userLogin($data){
		if(empty($data['username'])){
			$this->error='帐号不能为空';
			return false;
		}
		if(empty($data['password'])){
			$this->error='密码不能为空';
			return false;
		}
		$user=$this->where("username='{$data['username']}'")->find();
		if(empty($user)){
			$this->error='管理员不存在';
			return false;
		}
		if(md5($data['password'])!=$user['password']){
			$this->error='密码错误';
			return false;
		}
		$_SESSION['aid']=$user['aid'];
		$_SESSION['username']=$user['username'];
		return true;
	}
}


?>